/*
 * Copyright (c) 2007-2020 西安交通信息投资营运有限公司 版权所有
 */

package com.xci.edu.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.github.lvyanyang.core.BaseEntity;
import com.github.lvyanyang.core.BaseOperateUserEntity;
import com.github.lvyanyang.core.Const;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import java.util.Date;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 试卷信息
 * @author 马星俊 maxingjun@xci96716.com
 * @since 2020-11-25 10:52:08
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "试卷信息")
public class ExamPaper extends BaseOperateUserEntity {
    /**
     * 主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ExcelIgnore
    @Excel(name = "主键", width = 20d)
    @ApiModelProperty(value = "主键", position = 1)
    private Long id;

    /**
     * 试卷名称
     */
    @NotBlank(message = "试卷名称不能为空")
    @Length(max = 200, message = "试卷名称长度不能超过{max}个字符")
    @Excel(name = "试卷名称", width = 20d)
    @ApiModelProperty(value = "试卷名称", required = true, position = 2)
    private String name;

    /**
     * 试卷类型[1-普通试卷, 2-随机试卷]  
     */
    @NotNull(message = "试卷类型  不能为空")
    @Excel(name = "试卷类型  ", width = 20d, replace = { "普通试卷_1", "随机试卷_2" })
    @ApiModelProperty(value = "试卷类型[1-普通试卷, 2-随机试卷]  ", required = true, position = 3)
    private Integer paperCategory;

    /**
     * 试卷类型名称
     */
    @Excel(name = "试卷类型名称", width = 20d)
    @ApiModelProperty(value = "试卷类型名称", position = 3)
    private String paperCategoryName;

    /**
     * 试题类型名称
     */
    public String getPaperCategoryName(){
        switch(paperCategory) {
            case 1:
                return "普通试卷";
            case 2:
                return "随机试卷";
        }
        return Const.Empty;
    }

    /**
     * 自动生成:单选题数
     */
    @Excel(name = "自动生成:单选题数", width = 20d)
    @ApiModelProperty(value = "自动生成:单选题数", required = true, position = 4)
    private Integer autoRadioCount;

    /**
     * 自动生成:多选题数
     */
    @Excel(name = "自动生成:多选题数", width = 20d)
    @ApiModelProperty(value = "自动生成:多选题数", required = true, position = 5)
    private Integer autoCheckboxCount;

    /**
     * 自动生成:判断题数
     */
    @Excel(name = "自动生成:判断题数", width = 20d)
    @ApiModelProperty(value = "自动生成:判断题数", required = true, position = 6)
    private Integer autoYesnoCount;

    /**
     * 试卷总分
     */
    @NotNull(message = "试卷总分不能为空")
    @Excel(name = "试卷总分", width = 20d)
    @ApiModelProperty(value = "试卷总分", required = true, position = 7)
    private Integer totalScore;

    /**
     * 考试时长
     */
    @NotNull(message = "考试时长不能为空")
    @Excel(name = "考试时长", width = 20d)
    @ApiModelProperty(value = "考试时长", required = true, position = 8)
    private Integer totalDuration;

    /**
     * 及格分数
     */
    @NotNull(message = "及格分数不能为空")
    @Excel(name = "及格分数", width = 20d)
    @ApiModelProperty(value = "及格分数", required = true, position = 9)
    private Integer passScore;

    /**
     * 科目主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "科目主键不能为空")
    @Excel(name = "科目主键", width = 20d)
    @ApiModelProperty(value = "科目主键", required = true, position = 10)
    private Long eduCategoryId;

    /**
     * 科目名称
     */
    @NotBlank(message = "科目名称不能为空")
    @Length(max = 50, message = "科目名称长度不能超过{max}个字符")
    @Excel(name = "科目名称", width = 20d)
    @ApiModelProperty(value = "科目名称", required = true, position = 11)
    private String eduCategoryName;

    /**
     * 考试须知
     */
    @Length(max = 2000, message = "考试须知长度不能超过{max}个字符")
    @Excel(name = "考试须知", width = 20d)
    @ApiModelProperty(value = "考试须知", position = 12)
    private String notice;

    /**
     * 试题排序[0-固定, 1-随机]
     */
    @NotNull(message = "试题排序不能为空")
    @Excel(name = "试题排序", width = 20d, replace = { "固定_0", "随机_1" })
    @ApiModelProperty(value = "试题排序[0-固定, 1-随机]", required = true, position = 15)
    private Integer questionOrder;

    /**
     * 试题排序名称
     */
    @Excel(name = "试题排序名称", width = 20d)
    @ApiModelProperty(value = "试题排序名称", position = 15)
    private String questionOrderName;

    /**
     * 试题排序名称
     */
    public String getQuestionOrderName(){
        switch(questionOrder) {
            case 0:
                return "固定";
            case 1:
                return "随机";
        }
        return Const.Empty;
    }

    /**
     * 试题选项排序[0-固定, 1-随机]
     */
    @NotNull(message = "试题选项排序不能为空")
    @Excel(name = "试题选项排序", width = 20d, replace = { "固定_0", "随机_1" })
    @ApiModelProperty(value = "试题选项排序[0-固定, 1-随机]", required = true, position = 16)
    private Integer questionOptionOrder;

    /**
     * 试题选项排序名称
     */
    @Excel(name = "试题选项排序名称", width = 20d)
    @ApiModelProperty(value = "试题选项排序名称", position = 16)
    private String questionOptionOrderName;

    /**
     * 试题选项排序名称
     */
    public String getQuestionOptionOrderName(){
        switch(questionOptionOrder) {
            case 0:
                return "固定";
            case 1:
                return "随机";
        }
        return Const.Empty;
    }
    /**
     * 试卷展示[0-整卷展示, 1-单题展示]
     */
    @NotNull(message = "试卷展示不能为空")
    @Excel(name = "试卷展示", width = 20d, replace = { "整卷展示_0", "单题展示_1" })
    @ApiModelProperty(value = "试卷展示[0-整卷展示, 1-单题展示]", required = true, position = 17)
    private Integer showMode;

    /**
     * 试卷展示名称
     */
    @Excel(name = "试卷展示名称", width = 20d)
    @ApiModelProperty(value = "试试卷展示名称", position = 17)
    private String showModeName;

    /**
     * 试题类型名称
     */
    public String getShowModeName(){
        switch(showMode) {
            case 0:
                return "整卷展示";
            case 1:
                return "单题展示";
        }
        return Const.Empty;
    }
    /**
     * 开考限制;考试开始{}分钟后禁止参加考试
     */
    @NotNull(message = "开考限制;考试开始{}分钟后禁止参加考试不能为空")
    @Excel(name = "开考限制;考试开始{}分钟后禁止参加考试", width = 20d)
    @ApiModelProperty(value = "开考限制;考试开始{}分钟后禁止参加考试", required = true, position = 18)
    private Integer forbidEnter;

    /**
     * 交卷限制;开始考试{}分钟内不允许交卷
     */
    @NotNull(message = "交卷限制;开始考试{}分钟内不允许交卷不能为空")
    @Excel(name = "交卷限制;开始考试{}分钟内不允许交卷", width = 20d)
    @ApiModelProperty(value = "交卷限制;开始考试{}分钟内不允许交卷", required = true, position = 19)
    private Integer forbidSubmit;

    /**
     * 状态[1-启用, 0-禁用]
     */
    @NotNull(message = "状态不能为空")
    @Excel(name = "状态", width = 20d, replace = { "启用_1", "禁用_0" })
    @ApiModelProperty(value = "状态[1-启用, 0-禁用]", required = true, position = 20)
    private Integer status;

    /**
     * 备注
     */
    @Length(max = 500, message = "备注长度不能超过{max}个字符")
    @Excel(name = "备注", width = 20d)
    @ApiModelProperty(value = "备注", position = 21)
    private String remark;

    /**
     * 操作人主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @Excel(name = "操作人主键", width = 20d)
    @ApiModelProperty(value = "操作人主键", position = 22)
    private Long operateUserId;

    /**
     * 操作人
     */
    @Length(max = 100, message = "操作人长度不能超过{max}个字符")
    @Excel(name = "操作人", width = 20d)
    @ApiModelProperty(value = "操作人", position = 23)
    private String operateUserName;

    /**
     * 操作时间
     */
    @Excel(name = "操作时间", width = 20d, exportFormat = Const.DEFAULT_DATETIME_PATTERN)
    @ApiModelProperty(value = "操作时间", position = 24)
    private Date operateDateTime;

}